﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ray2010
{
    public class Tools
    {
        public Tools()
        {
        }

        public double CalculateDistance(Node node1, Node node2)
        {            
            return (Math.Sqrt(Math.Pow((node1.GetX() - node2.GetX()), 2) + Math.Pow((node1.GetY() - node2.GetY()), 2)));
        }

        public Node GetCentroid(Node node1, Node node2, Node node3)
        {
            long CoordX, CoordY;

            CoordX = (node1.GetX() + node2.GetX() + node3.GetX()) / 3;
            CoordY = (node1.GetY() + node2.GetY() + node3.GetY()) / 3;

            return new Node(CoordX, CoordY, true);
        } 

    }
}
